let compare a b = 
	if a > b 
		then 1
	else if a = b
		then 0
	else (-1);;

(*
let rec find nom list = match list with 
  	[] -> failwith "Le nom est introuvable"
  	|(a,b)::l if a = nom || String.lowercase a = nom || a = String.lowercase nom then b
			else find nom l;;
*)	
let rec add (nom,ac) list = match list with 
	[] -> (nom,ac)::[]
	|(a,b)::l -> if String.lowercase nom > String.lowercase a then (a,b)::add (nom,ac) l
				else if String.lowercase nom = String.lowercase a then failwith "Le prenom existe deja."
				else (nom,ac)::(a,b)::l;;
				
let rec delete nom list = match list with 
	[] -> []
	|(a,b)::l-> if nom = a then l
				else (a,b)::delete nom l;;
				
let rec update nom montant list = match list with
	[] -> []
	|(a,b)::l -> if nom = a then (nom,montant):: l
				else (a,b):: update nom montant l;;
				
let rec name nom1 nom2 list = match list with
	[] -> failwith "le nom est introuvable"
	|(a,b)::l -> if String.lowercase nom1 = String.lowercase a then (nom2,b)::l
				else (a,b)::name nom1 nom2 l;;
				
let rec sales list x = let f x = x-.(x*.0.1) in
	match list with 
		[] -> []
		|(a,b)::l -> (a, f b)::sales l x
